package com.miloyu.modelnet

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import com.miloyu.modelnet.network.ApiResponse
import com.miloyu.modelnet.network.HttpClient
import com.miloyu.modelnet.network.service.IApiService
import com.miloyu.modelnet.network.tools.RxUtils
import com.miloyu.modelnet.response.TokenVO

class NetActivity : AppCompatActivity() {
    private val TAG: String = NetActivity::class.java.simpleName

    private lateinit var btnLogin : Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_net)
        btnLogin = findViewById(R.id.btn_login)

        btnLogin.setOnClickListener{ toLogin()}
    }

    /**
     * HttpClient 作为 数据仓库
     */

    @SuppressLint("CheckResult")
    private fun toLogin() {
//        HttpClient.instance.create(IApiService :: class.java)
//            .login("13813813800", "123456")
//            .compose(RxUtils.compose())
//            .subscribe(object : ApiResponse<TokenVO>() {
//
//                override fun success(data: TokenVO?, msg: String?) {
//                    Log.d(TAG, "login $data")
//                }
//
//                override fun onFail(e: Throwable?, errorMsg: String?) {
//                    Log.d(TAG,"login $errorMsg")
//                }
//
//            })

    }
}